home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97a.txt / 000055_icon-group-sender _Fri Feb 28 14:17:52 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Received: by cheltenham.cs.arizona.edu; Fri, 28 Feb 1997 16:24:05 MST
  2. Message-Id: <1.5.4.32.19970228201752.006dcf90@post.its.mcw.edu>
  3. X-Sender: cdt@post.its.mcw.edu
  4. X-Mailer: Windows Eudora Light Version 1.5.4 (32)
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset="us-ascii"
  7. Date: Fri, 28 Feb 1997 14:17:52 -0600
  8. To: "John H. Lindsay" <lindsay_j@rmc.ca>, icon-group@cs.arizona.edu
  9. From: Chris Tenaglia <cdt@post.its.mcw.edu>
  10. Subject: Re: Icon and two-dimensional matching
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: RO
  13. Content-Length: 2375
  14.  
  15. snip...snip...
  16. >
  17. >The worst part is that, currently, Icon lacks anything like SNOBOL4's 
  18. >OPSYN that can be used to give unused unary prefix or binary infix 
  19. >operators a meaning or a new meaning.  Fortunately, with 
  20. >SNOBOL's polymorphic data, the ability to overload operators
  21. >is implicit and it would be implicit in Icon too if Icon had an 
  22. >OPSYN-like facility.
  23.  
  24. Since icon variables are not typed, the operators are. So if you were
  25. to define a operator, it seems like you'd need some way to define
  26. a new "data" type that the operator would cast the variable into.
  27.  
  28. .snip..
  29. >For this type of end, I'd love to see the ability in Icon to create new 
  30. >operators, and to extend and to redefine existing operators.   Even 
  31. >though Icon has very many pre-defined operators, Individual 
  32. >problems need more operators, and it seems to me that the lexical 
  33. >rule for 'what's an operator' is simple.  I'd hope that the facility would 
  34. >generalize the idea of prefix vs  postfix for unary operators with the 
  35. >idea of 2-operator and n-operator binary and n-ary expressions; 
  36. >such things seem to occur easily in natural language expressions.
  37. >The scope of such extensions could be open to discussion, but 
  38. >with record type definitons being global to a program, global scope
  39. >might be appropriate.  I wouldn't mind having to code parentheses 
  40. >to resolve ambiguities for this sort of thing.
  41.  
  42. I suggested this once too. I envisioned using the $ as a dynamic
  43. programmer defined operator. You'd need to define unary and
  44. binary properties and have to be careful about data conversions.
  45. But I guess someone was assigning $ to be some other part of
  46. the language at the time, and the idea never caught on.
  47.  
  48. examples....
  49. _____________________________________________________
  50. operator unary(myfunc)
  51. operator binary(otherfunc)
  52.  
  53. procedure myfunc(a)
  54.   return a * sin(1.00/a)
  55.   end
  56.  
  57. procedure otherfunc(a,b)
  58.   return a*a + b*b
  59.   end
  60. ______________________________________________________
  61.  
  62. >John H. Lindsay,
  63. >DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE
  64. >ROYAL MILITARY COLLEGE OF CANADA
  65. >PO BOX 17000  STN FORCES
  66. >KINGSTON  ON   K7K7B4
  67. >
  68. >
  69.  
  70. Chris Tenaglia (system manager)         |       cdt@post.its.mcw.edu
  71. Medical College of Wisconsin            |
  72. 8701 W. Watertown Plank Rd.             |      Ce que vous voyez est
  73. Milwaukee, WI 53226 (414)456-8765       |      Ce que vous obtenez !
  74.  
  75.